﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Pumptester.test
{
    public partial class ListView : Form
    {
        public ListView()
        {
            InitializeComponent();
        }

        private void ListView_Load(object sender, EventArgs e)
        {
            this.dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
            this.dataGridView.MergeColumnNames.Add("Column0");
            this.dataGridView.MergeColumnNames.Add("Column1");
            this.dataGridView.MergeColumnNames.Add("Column2");
            this.dataGridView.MergeColumnNames.Add("Column3");
            this.dataGridView.MergeColumnNames.Add("Column4");
            this.dataGridView.MergeColumnNames.Add("Column5");
            this.dataGridView.MergeColumnNames.Add("Column6");
            this.dataGridView.MergeColumnNames.Add("Column7");
            this.dataGridView.MergeColumnNames.Add("Column8");
            this.dataGridView.MergeColumnNames.Add("Column9");
            //this.dataGridView.MergeColumnNames.Add("Column10");
            this.dataGridView.AddSpanHeader(0, 10, "转换前数据");

            this.dataGridView.MergeColumnNames.Add("Column10");
            this.dataGridView.MergeColumnNames.Add("Column11");
            this.dataGridView.MergeColumnNames.Add("Column12");
            this.dataGridView.MergeColumnNames.Add("Column13");
            this.dataGridView.MergeColumnNames.Add("Column14");
            this.dataGridView.MergeColumnNames.Add("Column15");
            this.dataGridView.AddSpanHeader(10, 6, "转换后数据");
        }

        private void dataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        {
         /*   
            if (e.RowIndex == -1)
            {
                using (
                    Brush gridBrush = new SolidBrush(Color.Green), 
                    backColorBrush = new SolidBrush(e.CellStyle.BackColor))

                {

                    using (Pen gridLinePen = new Pen(gridBrush))
                    {
                       


                        e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left,
                   e.CellBounds.Bottom - 1, e.CellBounds.Right - 1,
                   e.CellBounds.Bottom - 1);
                        if (e.ColumnIndex != 9)
                        {
                            e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1,
                       e.CellBounds.Top + e.ClipBounds.Height / 2, e.CellBounds.Right - 1,
                       e.CellBounds.Bottom);
                        }
                        else
                        {
                            e.Graphics.DrawLine(gridLinePen, e.CellBounds.Right - 1,
                                                 e.CellBounds.Top , e.CellBounds.Right - 1,
                                                 e.CellBounds.Bottom);
                        }
                        

                         int    scale = e.CellBounds.Height / 2;
           
                            e.Graphics.DrawLine(gridLinePen, e.CellBounds.Left, e.CellBounds.Bottom - e.CellBounds.Height / 2, e.CellBounds.Right, e.CellBounds.Bottom - e.CellBounds.Height / 2);
                        if (e.Value != null)
                        {


                            e.Graphics.DrawString(e.Value.ToString(), e.CellStyle.Font,
                                Brushes.Crimson, e.CellBounds.X + 2,
                                e.CellBounds.Y + scale + 2, StringFormat.GenericDefault);



                        }
                        RectangleF rectangle = new Rectangle(e.CellBounds.X, e.CellBounds.Y, 800, e.CellBounds.Height / 2);
                        e.Graphics.FillRectangle(backColorBrush, rectangle);

                        e.Graphics.DrawString("测试", e.CellStyle.Font
                           , Brushes.Black
                           , rectangle.Left + rectangle.Width / 2 -
                           e.Graphics.MeasureString("测试", e.CellStyle.Font).Width / 2 - 1
                           , rectangle.Top +
                           rectangle.Height / 2 - e.Graphics.MeasureString("测试", e.CellStyle.Font).Height / 2);
                      


                        e.Handled = true;
                    }
                }
            }*/
        }

        private void tabPageDataGrid_Click(object sender, EventArgs e)
        {
 
        }
    }
}
